package com.xiyu.service.vo.mailbox.account.baseVO;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
import org.hibernate.validator.constraints.*;

import jakarta.validation.constraints.Email;
import org.springframework.format.annotation.DateTimeFormat;
import static com.xiyu.service.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import java.time.LocalDateTime;

/**
 * 邮箱账号 Base VO，提供给添加、修改、详细的子 VO 使用
 * 如果子 VO 存在差异的字段，请不要添加到这里，影响 Swagger 文档生成
 */
@Data
public class MailboxAccountBase {

    @Schema(description = "账号")
    @Email(message = "邮箱格式不正确")
    @Size(max = 255, message = "地址长度不能超过255")
    private String mailboxAccount;

    @Schema(description = "密码")
    @Size(max = 255, message = "密码长度不能超过255")
    private String mailboxPassword;

    @Schema(description = "显示名称")
    @Size(max = 255, message = "显示名称长度不能超过255")
    private String showName;

    @Schema(description = "发信名称")
    @Size(max = 255, message = "发信名称长度不能超过255")
    private String sendName;

    @Schema(description = "定时收取邮件")
    private Boolean isTimeReceive;

    @Schema(description = "定时收取邮件间隔")
    @Range(max = 100000000, message = "定时收取邮件间隔最大不能超过100000000")
    private Integer timeReceiveInterval;

    @Schema(description = "邮箱类型")
    @Range(max = 127, message = "邮箱类型最大不能超过127")
    private Integer mailboxProtocolType;

    @Schema(description = "收件服务器地址")
    @Size(max = 255, message = "收件服务器地址长度不能超过255")
    private String receiveAddress;

    @Schema(description = "收件服务器SSL")
    private Boolean isReceiveSecure;

    @Schema(description = "收件服务器端口")
    @Range(max = 100000000, message = "收件服务器端口最大不能超过100000000")
    private Integer receivePort;

    @Schema(description = "发件服务器地址")
    @Size(max = 255, message = "发件服务器地址长度不能超过255")
    private String sendAddress;

    @Schema(description = "发件服务器SSL")
    private Boolean isSendSecure;

    @Schema(description = "发件服务器端口")
    @Range(max = 100000000, message = "发件服务器端口最大不能超过100000000")
    private Integer sendPort;

    @Schema(description = "拥有人")
    private Long ownerId;

    @Schema(description = "STARTTLS加密传输")
    private Boolean isStarttls;

    @Schema(description = "上次收取邮件时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime lastReceiveTime;

}
